import 'package:flutter/material.dart';

class CustomeRoute extends PageRouteBuilder {
  final Widget widget;

  CustomeRoute(this.widget)
      : super(
            transitionDuration: Duration(seconds: 1),
            pageBuilder: (
              BuildContext context,
              Animation<double> a1,
              Animation<double> a2,
            ) {
              return widget;
            },
            transitionsBuilder: (BuildContext context, Animation<double> a1,
                Animation<double> a2, Widget child) {
              //
//              return FadeTransition(
//                  opacity: Tween(begin: 0.0, end: 1.0).animate(
//                      CurvedAnimation(parent: a1, curve: Curves.fastOutSlowIn)),
//                  child: child);

              //缩放
//              return ScaleTransition(
//                  scale: Tween(begin: 0.0, end: 1.0).animate(
//                    CurvedAnimation(parent: a1, curve: Curves.fastOutSlowIn),
//                  ),
//                  child: child);

//              return RotationTransition(
//                  turns: Tween(begin: 0.0, end: 1.0).animate(
//                      CurvedAnimation(parent: a1, curve: Curves.fastOutSlowIn)),
//                  child: ScaleTransition(
//                    scale: Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation(
//                        parent: a1, curve: Curves.fastOutSlowIn)),
//                    child: child,
//                  ));
              //左右滑动
              return SlideTransition(
                position: Tween<Offset>(
                        begin: Offset(-1.0, 0.0), end: Offset(0.0, 0.0))
                    .animate(CurvedAnimation(
                        parent: a1, curve: Curves.fastLinearToSlowEaseIn)),
                child: child,
              );
            });
}
